<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module Bundler::Plugin::API::Source - bundler: Ruby Standard Library Documentation</title>


<script src="../../../js/navigation.js" defer></script>
<script src="../../../js/search.js" defer></script>
<script src="../../../js/search_index.js" defer></script>
<script src="../../../js/searcher.js" defer></script>
<script src="../../../js/darkfish.js" defer></script>

<script src="../../../js/jquery-3.2.0.min.js"></script>

<script src="../../../js/vue.min.js"></script>
<script src="../../../js/js.cookie.min.js"></script>

<link href="../../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../../css/rdoc.css" rel="stylesheet">
<link href="../../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
  var index_rel_prefix = "../../../";
  var darkModeCsseHref = "../../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-3D-3D">#==</a>
    <li ><a href="#method-i-add_dependency_names">#add_dependency_names</a>
    <li ><a href="#method-i-app_cache_dirname">#app_cache_dirname</a>
    <li ><a href="#method-i-app_cache_path">#app_cache_path</a>
    <li ><a href="#method-i-cache">#cache</a>
    <li ><a href="#method-i-cached-21">#cached!</a>
    <li ><a href="#method-i-can_lock-3F">#can_lock?</a>
    <li ><a href="#method-i-double_check_for">#double_check_for</a>
    <li ><a href="#method-i-eql-3F">#eql?</a>
    <li ><a href="#method-i-fetch_gemspec_files">#fetch_gemspec_files</a>
    <li ><a href="#method-i-gem_install_dir">#gem_install_dir</a>
    <li ><a href="#method-i-hash">#hash</a>
    <li ><a href="#method-i-identifier">#identifier</a>
    <li ><a href="#method-i-include-3F">#include?</a>
    <li ><a href="#method-i-install">#install</a>
    <li ><a href="#method-i-install_path">#install_path</a>
    <li ><a href="#method-i-installed-3F">#installed?</a>
    <li ><a href="#method-i-local-21">#local!</a>
    <li ><a href="#method-i-options_to_lock">#options_to_lock</a>
    <li ><a href="#method-i-post_install">#post_install</a>
    <li ><a href="#method-i-remote-21">#remote!</a>
    <li ><a href="#method-i-root">#root</a>
    <li ><a href="#method-i-spec_names">#spec_names</a>
    <li ><a href="#method-i-specs">#specs</a>
    <li ><a href="#method-i-to_lock">#to_lock</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-unlock-21">#unlock!</a>
    <li ><a href="#method-i-unmet_deps">#unmet_deps</a>
    <li ><a href="#method-i-uri_hash">#uri_hash</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-Bundler::Plugin::API::Source">
    <h1 id="module-Bundler::Plugin::API::Source" class="module">
      module Bundler::Plugin::API::Source
    </h1>

    <section class="description">
    
<p>This class provides the base to build source plugins All the method here are required to build a source plugin (except ‘uri_hash`, `gem_install_dir`; they are helpers).</p>

<p>Defaults for methods, where ever possible are provided which is expected to work. But, all source plugins have to override ‘fetch_gemspec_files` and `install`. Defaults are also not provided for `remote!`, `cache!` and `unlock!`.</p>

<p>The defaults shall work for most situations but nevertheless they can be (preferably should be) overridden as per the plugins’ needs safely (as long as they behave as expected). On overriding ‘initialize` you should call super first.</p>

<p>If required plugin should override ‘hash`, `==` and `eql?` methods to be able to match objects representing same sources, but may be created in different situation (like form gemfile and lockfile). The default ones checks only for class and uri, but elaborate source plugins may need more comparisons (e.g. git checking on branch or tag).</p>

<p>@!attribute [r] uri</p>

<pre>@return [String] the remote specified with `source` block in Gemfile</pre>

<p>@!attribute [r] options</p>

<pre>@return [String] options passed during initialization (either from
  lockfile or Gemfile)</pre>

<p>@!attribute [r] name</p>

<pre>@return [String] name that can be used to uniquely identify a source</pre>

<p>@!attribute [rw] <a href="Source.html#attribute-i-dependency_names"><code>dependency_names</code></a></p>

<pre>@return [Array&lt;String&gt;] Names of dependencies that the source should
  try to resolve. It is not necessary to use this list internally. This
  is present to be compatible with `Definition` and is used by
  rubygems source.</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-dependency_names" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dependency_names</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-name" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">name</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-options" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">options</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-uri" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">uri</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(opts)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">opts</span>)
  <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">opts</span>
  <span class="ruby-ivar">@dependency_names</span> = []
  <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;uri&quot;</span>]
  <span class="ruby-ivar">@type</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;type&quot;</span>]
  <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;name&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-node">&quot;#{@type} at #{@uri}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-3D-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">==</span><span
                                class="method-args">(other)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This shall check if two source object represent the same source.</p>

<p>The comparison shall take place only on the attribute that can be inferred from the options passed from Gemfile and not on attributes that are used to pin down the gem to specific version (e.g. Git sources should compare on branch and tag but not on commit hash)</p>

<p>The sources objects are constructed from Gemfile as well as from lockfile. To converge the sources, it is necessary that they match.</p>

<p>The same applies for ‘eql?` and `hash`</p>

                              <div class="method-source-code" id="3D-3D-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 212</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">==</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">uri</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Source.html#method-i-eql-3F">eql?</a>
                            </div>

                          </div>

                  <div id="method-i-add_dependency_names" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_dependency_names</span><span
                                class="method-args">(names)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Used by definition.</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="add_dependency_names-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 257</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_dependency_names</span>(<span class="ruby-identifier">names</span>)
  <span class="ruby-ivar">@dependencies</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">names</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-app_cache_dirname" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">app_cache_dirname</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Name of directory where plugin the is expected to cache the gems when <a href="Source.html#method-i-cache"><code>cache</code></a> is called.</p>

<p>Also this name is matched against the directories in cache for pruning</p>

<p>This is used by ‘app_cache_path`</p>

                              <div class="method-source-code" id="app_cache_dirname-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 177</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">app_cache_dirname</span>
  <span class="ruby-identifier">base_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">path</span>)
  <span class="ruby-node">&quot;#{base_name}-#{uri_hash}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-app_cache_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">app_cache_path</span><span
                                class="method-args">(custom_path = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The full path where the plugin should cache the gem so that it can be installed latter.</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="app_cache_path-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 236</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">app_cache_path</span>(<span class="ruby-identifier">custom_path</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-ivar">@app_cache_path</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">app_cache</span>(<span class="ruby-identifier">custom_path</span>).<span class="ruby-identifier">join</span>(<span class="ruby-identifier">app_cache_dirname</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cache" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cache</span><span
                                class="method-args">(spec, custom_path = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This method is called while caching to save copy of the gems that the source can resolve to path provided by ‘app_cache_app`so that they can be reinstalled from the cache without querying the remote (i.e. an alternative to remote)</p>

<p>This is stored with the app and source plugins should try to provide specs and install only from this cache when ‘cached!` is called.</p>

<p>This cache is different from the internal caching that can be done at sub paths of ‘cache_path` (from <a href="../API.html"><code>API</code></a>). This can be though as caching by bundler.</p>

                              <div class="method-source-code" id="cache-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 193</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cache</span>(<span class="ruby-identifier">spec</span>, <span class="ruby-identifier">custom_path</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">new_cache_path</span> = <span class="ruby-identifier">app_cache_path</span>(<span class="ruby-identifier">custom_path</span>)

  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">new_cache_path</span>)
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp_r</span>(<span class="ruby-identifier">install_path</span>, <span class="ruby-identifier">new_cache_path</span>)
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">touch</span>(<span class="ruby-identifier">app_cache_path</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;.bundlecache&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cached-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cached!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set internal representation to fetch the gems/specs from app cache.</p>

<p>When this is called, the source should try to fetch the specs and install from the path provided by ‘app_cache_path`.</p>

                              <div class="method-source-code" id="cached-21-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 161</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cached!</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-can_lock-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">can_lock?</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>NOTE: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="can_lock-3F-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 262</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">can_lock?</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">source</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-double_check_for" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">double_check_for</span><span
                                class="method-args">(*)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@private This <a href="../API.html"><code>API</code></a> on source might not be stable, and for now we expect plugins to download all specs in ‘#specs`, so we implement the method for compatibility purposes and leave it undocumented (and don’t support) overriding it)</p>

                              <div class="method-source-code" id="double_check_for-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 316</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">double_check_for</span>(<span class="ruby-operator">*</span>); <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-eql-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">eql?</span><span
                                class="method-args">(other)</span>
                            </div>

                            <div class="method-description">
                              <p>When overriding ‘eql?` please preserve the behaviour as mentioned in docstring for `==` method.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Source.html#method-i-3D-3D">==</a>
                            </div>
                          </div>

                  <div id="method-i-fetch_gemspec_files" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">fetch_gemspec_files</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This is used by the default ‘spec` method to constructs the Specification objects for the gems and versions that can be installed by this source plugin.</p>

<p>Note: If the spec method is overridden, this function is not necessary</p>

<p>@return [Array&lt;String&gt;] paths of the gemspec files for gems that can</p>

<pre class="ruby"><span class="ruby-identifier">be</span> <span class="ruby-identifier">installed</span>
</pre>

                              <div class="method-source-code" id="fetch_gemspec_files-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 61</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fetch_gemspec_files</span>
  []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gem_install_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gem_install_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>NOTE: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="gem_install_dir-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 298</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gem_install_dir</span>
  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">install_path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">hash</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>When overriding ‘hash` please preserve the behaviour as mentioned in docstring for `==` method, i.e. two methods equal by above comparison should have same hash.</p>

                              <div class="method-source-code" id="hash-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 223</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">hash</span>
  [<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">uri</span>].<span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-identifier" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">identifier</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Source.html#method-i-to_s">to_s</a>
                            </div>
                          </div>

                  <div id="method-i-include-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">include?</span><span
                                class="method-args">(other)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>NOTE: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="include-3F-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 289</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">include?</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-identifier">other</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-install" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">install</span><span
                                class="method-args">(spec, opts)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Install the gem specified by the spec at appropriate path. ‘install_path` provides a sufficient default, if the source can only satisfy one gem,  but is not binding.</p>

<p>@return [String] post installation message (if any)</p>

                              <div class="method-source-code" id="install-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 81</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">install</span>(<span class="ruby-identifier">spec</span>, <span class="ruby-identifier">opts</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">MalformattedPlugin</span>, <span class="ruby-string">&quot;Source plugins need to override the install method.&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-install_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">install_path</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A default installation path to install a single gem. If the source servers multiple gems, it’s not of much use and the source should one of its own.</p>

                              <div class="method-source-code" id="install_path-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">install_path</span>
  <span class="ruby-ivar">@install_path</span> <span class="ruby-operator">||=</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">base_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">normalize</span>.<span class="ruby-identifier">path</span>)

      <span class="ruby-identifier">gem_install_dir</span>.<span class="ruby-identifier">join</span>(<span class="ruby-node">&quot;#{base_name}-#{uri_hash[0..11]}&quot;</span>)
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-installed-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">installed?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A helper method, not necessary if not used internally.</p>

                              <div class="method-source-code" id="installed-3F-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 228</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">installed?</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">install_path</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-local-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">local!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set internal representation to fetch the gems/specs locally.</p>

<p>When this is called, the source should try to fetch the specs and install from the local system.</p>

                              <div class="method-source-code" id="local-21-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 147</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">local!</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-options_to_lock" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">options_to_lock</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Options to be saved in the lockfile so that the source plugin is able to check out same version of gem later.</p>

<p>There options are passed when the source plugin is created from the lock file.</p>

<p>@return [Hash]</p>

                              <div class="method-source-code" id="options_to_lock-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">options_to_lock</span>
  {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-post_install" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_install</span><span
                                class="method-args">(spec, disable_exts = false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>It builds extensions, generates bins and installs them for the spec provided.</p>

<p>It depends on ‘spec.loaded_from` to get full_gem_path. The source plugins should set that.</p>

<p>It should be called in ‘install` after the plugin is done placing the gem at correct install location.</p>

<p>It also runs <a href="../../../Gem.html"><code>Gem</code></a> hooks ‘pre_install`, `post_build` and `post_install`</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="post_install-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 97</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">post_install</span>(<span class="ruby-identifier">spec</span>, <span class="ruby-identifier">disable_exts</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">opts</span> = { <span class="ruby-value">:env_shebang</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">:disable_extensions</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">disable_exts</span> }
  <span class="ruby-identifier">installer</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Path</span><span class="ruby-operator">::</span><span class="ruby-constant">Installer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spec</span>, <span class="ruby-identifier">opts</span>)
  <span class="ruby-identifier">installer</span>.<span class="ruby-identifier">post_install</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remote-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remote!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set internal representation to fetch the gems/specs from remote.</p>

<p>When this is called, the source should try to fetch the specs and install from remote path.</p>

                              <div class="method-source-code" id="remote-21-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 154</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remote!</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-root" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">root</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>It is used to obtain the full_gem_path.</p>

<p>spec’s loaded_from path is expanded against this to get full_gem_path</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="root-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 307</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">root</span>
  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">root</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-spec_names" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">spec_names</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Used by definition.</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="spec_names-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 250</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">spec_names</span>
  <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">spec_names</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-specs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">specs</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses the gemspec files to find the specs for the gems that can be satisfied by the source.</p>

<p>Few important points to keep in mind:</p>

<pre>- If the gems are not installed then it shall return specs for all
the gems it can satisfy
- If gem is installed (that is to be detected by the plugin itself)
then it shall return at least the specs that are installed.
- The `loaded_from` for each of the specs shall be correct (it is
used to find the load path)</pre>

<p>@return [Bundler::Index] index containing the specs</p>

                              <div class="method-source-code" id="specs-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 127</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">specs</span>
  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">fetch_gemspec_files</span>

  <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">Index</span>.<span class="ruby-identifier">build</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">spec</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">load_gemspec</span>(<span class="ruby-identifier">file</span>)
      <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">rubygems</span>.<span class="ruby-identifier">set_installed_by_version</span>(<span class="ruby-identifier">spec</span>)

      <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">source</span> = <span class="ruby-keyword">self</span>
      <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">rubygems</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">spec</span>)

      <span class="ruby-identifier">index</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">spec</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_lock" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_lock</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Generates the content to be entered into the lockfile. Saves type and remote and also calls to ‘options_to_lock`.</p>

<p><a href="../../Plugin.html"><code>Plugin</code></a> should use ‘options_to_lock` to save information in lockfile and not override this.</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="to_lock-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 273</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_lock</span>
  <span class="ruby-identifier">out</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{LockfileParser::PLUGIN}\n&quot;</span>)
  <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;  remote: #{@uri}\n&quot;</span>
  <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;  type: #{@type}\n&quot;</span>
  <span class="ruby-identifier">options_to_lock</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opt</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;  #{opt}: #{value}\n&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;  specs:\n&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 283</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-node">&quot;plugin source for #{@type} with uri #{@uri}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Source.html#method-i-identifier">identifier</a>
                            </div>

                          </div>

                  <div id="method-i-unlock-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">unlock!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This is called to update the spec and installation.</p>

<p>If the source plugin is loaded from lockfile or otherwise, it shall refresh the cache/specs (e.g. git sources can make a fresh clone).</p>

                              <div class="method-source-code" id="unlock-21-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 168</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock!</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-unmet_deps" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">unmet_deps</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Used by definition.</p>

<p>Note: Do not override if you don’t know what you are doing.</p>

                              <div class="method-source-code" id="unmet_deps-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 243</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unmet_deps</span>
  <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">unmet_dependency_names</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-uri_hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">uri_hash</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="uri_hash-source">
            <pre><span class="ruby-comment"># File bundler/plugin/api/source.rb, line 293</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">uri_hash</span>
  <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-value">:SHA1</span>).<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">uri</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

